package com.java.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 部门信息
 * @author wqf
 * @version  Nov 24, 2011 9:48:59 AM
 */
@Entity
@org.hibernate.annotations.Entity(
		selectBeforeUpdate = true, 
		dynamicInsert = true, 
		dynamicUpdate = true
)
@Table(name="department")
public class Department implements Serializable {

	private static final long serialVersionUID = -4368426096340185437L;
	@Id
	@GeneratedValue
	private Long id;
	
	/**
	 * 部门名称
	 */
	@Column(length=100)
	private String deptName;
	
	/**
	 * 职能说明
	 */
	@Column(length=200)
	private String detail;
		
	/**
	 * 排列序号
	 */
	@Column
	private Integer orderNo = 0;
			
	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public Integer getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(Integer orderNo) {
		this.orderNo = orderNo;
	}

	@OneToMany(cascade = CascadeType.ALL,mappedBy="department",fetch=FetchType.LAZY)
	private List<User> userList=new ArrayList<User>();
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}


	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}

}
